<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>统计⼀个字符串中某个字符出现的次数</title>
</head>

<body>
    <script>
        /*这个字符串中的每个字每出现了多少次*/
        var ary = "weqhdsfwkhjdshjkw fdsj fdkjs dsjk dshjf fjhk";
        var arr=ary.match(/w/gi)
        console.log(arr.length)


    </script>
</body>

</html>